import email
import quopri
"""
参考：https://www.cnblogs.com/sislcb/archive/2008/12/01/1344860.html
如果是Quoted-Printable编码的，需要使用quopri来解码
"""
fp = open("E:\\风清徒\\【征集调查】ID15316：“上好学”问题及意见建议.eml", "r")
msg = email.message_from_file(fp)
for par in msg.walk():
    if not par.is_multipart():
        name = par.get_param("name")
        if name:
            pass
        else:
            p = par.get_payload(decode=True)
            print(p)
            print(quopri.decodestring(p).decode("utf-8").strip())

